// src/lib/api/client.ts
import axios from "axios";

const client = axios.create({
  // baseURL: import.meta.env.VITE_API_BASE_URL || "http://localhost:8080/",
  timeout: 10000,
});

// 请求拦截器
client.interceptors.request.use((config) => {
  // 比如可以在这里加 token
  // const token = localStorage.getItem("token");
  // if (token) config.headers.Authorization = `Bearer ${token}`;
  return config;
});

// 响应拦截器
client.interceptors.response.use(
  (response) => response,
  (error) => {
    console.error("API Error:", error);
    return Promise.reject(error);
  }
);

export default client;

